using UnityEngine;
using System.Collections.Generic;

public class EnemyScript : MonoBehaviour {

	public float percentageXofScreen;
	public float tracksSpacingPercentage;
	
    void Start()
    {
		transform.localScale = MainScript.scaleFromScreen(gameObject, percentageXofScreen);
    }

    void Update()
    {
  		transform.Translate(Vector3.up*(Time.deltaTime * MainScript.bgShiftYInitial));
		//if piece is outside the screen, put it down
		//1.5f make it later than just on the first frame outside the screen avoiding black lines on the top
        if (transform.position.y > (MainScript.cameraSize*2.0f)*1.5f)
        {
            transform.position -= Vector3.up * collider.bounds.size.y*MainScript.enemyCount;
			//put this piece on the top of the stack of background instances
			//GameScript.updateEnemyList();
        }
    }
}
